package com.starbaba.statistics.utils;
/**
 * 时间格式转换工具类
 * @author wangzhuobin
 *
 */
public class TimeUtils {

	/**
	 * 把毫秒转化成00:00:00的方法
	 * @param time
	 * @return
	 */
	public static String changeToString(long time) {
		StringBuilder sb = new StringBuilder();
		time = time / 1000;
		if (time < 0) {
			sb.append("00:00:00");
		} else {
			long hour = time / 3600;
			if (hour < 10) {
				sb.append("0");
			}
			sb.append(hour);
			time = time % 3600;
			long minute = time / 60;
			sb.append(":");
			if (minute < 10) {
				sb.append("0");
			}
			sb.append(minute);
			time = time % 60;
			sb.append(":");
			if (time < 10) {
				sb.append("0");
			}
			sb.append(time);
		}
		return sb.toString();
	}
}
